Cytosim  PI
Cytoskeleton Simulator
Vector1 Class Reference

Public Member Functions

 Vector1 ()
 by default, coordinates are not initialized
 
 Vector1 (const real x, const real)
 construct from values
 
 Vector1 (const real x, const real, const real)
 construct from values
 
 Vector1 (const real v[])
 construct from address
 
 Vector1 (const real v[], const int &d)
 construct from array of size d
 
 ~Vector1 ()
 destructor (is not-virtual: do not derive from this class)
 
 operator real * ()
 implicit conversion to a modifiable real[] array
 
 operator const real * () const
 implicit conversion to a const real[] array
 
realaddr ()
 conversion to a 'real array'
 
realoperator[] (const unsigned ii)
 modifiable access to individual coordinates
 
void get (const real b[])
 replace coordinates by the ones provided
 
void get (const real v[], const int &d)
 copy coordinates from array of size d
 
void put (real b[]) const
 copy coordinates to given array
 
void addTo (real b[]) const
 add to given array
 
void addFrom (real b[])
 change coordinates by adding given array
 
void subTo (real b[]) const
 subtract to given array
 
void subFrom (real b[])
 change coordinates by subtracting given array
 
void set (const real x)
 change coordinates
 
void set (const real x, const real, const real)
 change coordinates
 
void oppose ()
 change signs of all coordinates
 
real normSqr () const
 the square of the standard norm
 
real norm () const
 the standard norm = sqrt(x^2+y^2+z^2)
 
real distanceSqr (Vector1 const &a) const
 square of the distance to other point == (a-this).normSqr()
 
real distance (Vector1 const &a) const
 distance to other point == (a-this).norm()
 
real minimum () const
 returns min(x, y, z)
 
real maximum () const
 returns max(x, y, z)
 
real norm_inf () const
 the infinite norm = max(|x|, |y|, |z|)
 
void normalize (const real n=1.0)
 normalize to norm=n
 
const Vector1 normalized (const real n=1.0) const
 returns the colinear vector of norm=n
 
const Vector1 orthogonal () const
 returns a perpendicular vector, of comparable but unspecified norm
 
const Vector1 orthogonal (const real) const
 returns a perpendicular vector, of norm n
 
const Vector1 e_mul (const real b[]) const
 returns the element-by-element product
 
const Vector1 e_div (const real b[]) const
 returns the element-by-element division
 
void operator+= (Vector1 const &b)
 addition of another vector b
 
void operator-= (Vector1 const &b)
 subtraction of another vector b
 
void operator*= (const real b)
 multiplication by a scalar
 
void operator/= (const real b)
 division by a scalar
 
std::string str () const
 conversion to a string
 
void print (FILE *out=stdout) const
 print to a file
 
void pprint (FILE *out=stdout) const
 print to a file, surrounded by parenthesis
 
void println (FILE *out=stdout) const
 print, followed by a new line
 
void addRand (real s)
 add a random component in [-s, s] to each coordinate
 
const Vector1 randPerp (real n) const
 a vector of norm n, orthogonal to *this, chosen randomly and uniformly
 

Static Public Member Functions

static unsigned dimensionality ()
 dimensionality
 
static Vector1 make (const real b[])
 create new Vector with coordinates from the given array
 
static const Vector1 randBox ()
 random Vector with coordinates set randomly and independently in [-1,+1]
 
static const Vector1 randBox (real n)
 set all coordinates randomly and independently in [-n,+n]
 
static const Vector1 randUnit ()
 random Vector of norm = 1; sampling is uniform
 
static const Vector1 randUnit (real n)
 return a random vector of norm = n; sampling is uniform
 
static const Vector1 randBall ()
 return a random vector of norm <= 1; sampling is uniform
 
static const Vector1 randBall (real n)
 return a random vector of norm <= n; sampling is uniform
 
static const Vector1 randGauss (real n)
 return a random vector with Normally distributed coordinates ~ N(0,n)
 

Public Attributes

real XX
 coordinates are public
 

Friends

const Vector1 operator+ (Vector1 const &a, Vector1 const &b)
 addition of two vectors
 
const Vector1 operator- (Vector1 const &a, Vector1 const &b)
 subtraction of two vectors
 
const Vector1 operator+ (Vector1 const &b)
 unary + operator does nothing
 
const Vector1 operator- (Vector1 const &b)
 opposition of a vector
 
real vecProd (Vector1 const &a, Vector1 const &b)
 the cross product of two vectors is a Z-Vector More...
 
const Vector1 vecProd (Vector1 const &a, const real b)
 cross product of a vector with a Z-Vector
 
const Vector1 vecProd (const real a, Vector1 const &b)
 cross product of a Z-vector with a Vector
 
real operator* (Vector1 const &a, Vector1 const &b)
 scalar product of two vectors
 
const Vector1 operator* (Vector1 const &a, const real s)
 multiplication by scalar s
 
const Vector1 operator* (const real s, Vector1 const &a)
 mutiplication by scalar s
 
const Vector1 operator/ (Vector1 const &a, const real s)
 division by scalar s
 
bool operator== (Vector1 const &a, Vector1 const &b)
 equality test
 
bool operator!= (Vector1 const &a, Vector1 const &b)
 non-equality test
 

Friends And Related Function Documentation

real vecProd ( Vector1 const &  a,
Vector1 const &  b 
)
friend

In dimension 1, the vector product is not really useful, but it is defined for completeness with the other class Vector2, Vector3.